/**
 * 
 */
package com.yidu.erp.action.finance;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.common.Pages;
import com.yidu.erp.model.BeyondStaff;
import com.yidu.erp.service.finance.FinanceService;

/**
 *
 * @author zengren
 * @date 2017年12月11日
 * @version 1.0
 */
@Controller
@RequestMapping("finance")
public class FinanceAction {
	
	@Resource
	private FinanceService financeService;
	
	/**
	 * 显示当前登录人所在分店的余额
	 * @param session
	 * @return
	 */
	@RequestMapping("showYE")
	@ResponseBody
	public String showYE(HttpSession session){
		String annexId = ((BeyondStaff)session.getAttribute("staff")).getAnnexId();
		return financeService.showYE(annexId);
	}
	
	/**
	 * 显示分店的支出记录
	 * @param session
	 * @param paramMap
	 * @param limit
	 * @param page
	 * @return
	 */
	@RequestMapping("showFinancialOut")
	@ResponseBody
	public Map<String, Object> showFinancialOut(HttpSession session, @RequestParam Map<String, Object> paramMap, Integer limit, Integer page){
		if(limit!=null && page!=null){
			Pages pages = new Pages();
			pages.setCurPage(page);
			pages.setMaxResult(limit);
			paramMap.put("pages", pages);
		}
		paramMap.put("annexId", ((BeyondStaff)session.getAttribute("staff")).getAnnexId());
		return financeService.showFinancialOut(paramMap);
	}
	
	/**
	 * 显示分店的收入记录
	 * @return
	 */
	@RequestMapping("showFinancialIn")
	@ResponseBody
	public Map<String, Object> showFinancialIn(HttpSession session, @RequestParam Map<String, Object> paramMap, Integer limit, Integer page){
		if(limit!=null && page!=null){
			Pages pages = new Pages();
			pages.setCurPage(page);
			pages.setMaxResult(limit);
			paramMap.put("pages", pages);
		}
		paramMap.put("annexId", ((BeyondStaff)session.getAttribute("staff")).getAnnexId());
		return financeService.showFinancialIn(paramMap);
	}
	
	
	
	
}
